<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>

<script type="text/javascript">
    var WEBSOCKET = null
    function onOpen() {
        console.log(1)
        sendMessage("test")
    };

    function onError(err) {
        console.log(err)
    };

    function onMessage(msg) {
        console.log(msg)
    }

    function sendMessage(msg) {
        WEBSOCKET.send(msg)
    }

    if (typeof (WebSocket) === "undefined") {
        alert('your browser does not support WebSocket...');
    } else {
        let webSocket = new WebSocket("ws://localhost:10086/websocket");
        WEBSOCKET = WebSocket
        webSocket.onopen = onOpen
        webSocket.onerror = onError
        webSocket.onmessage = onMessage
    }
</script>
</html>